package cn.com.wangluotongxin.linux.constants;

public enum FileTypeEnum {
    FILE(1, "文件", ""),
    JPG(2, "JPG图片", ".jpg"),
    PNG(3, "PNG图片", ".png"),
    TXT(4, "TXT文本文件", ".txt"),
    XLS(5, "XLS文件", ".xls"),
    XLSX(6, "XLSX文件", ".xlsx"),
    DOC(7, "DOC文件", ".doc");

    private Integer code;

    public Integer getCode() {
        return code;
    }

    private String name;

    public String getName() {
        return name;
    }

    private String suffix;

    public String getSuffix() {
        return suffix;
    }

    public static FileTypeEnum getByCode(Integer code) {
        if(code == null) {
            return null;
        } else {
            FileTypeEnum[] values = values();
            for(FileTypeEnum value : values) {
                if(code.equals(value.getCode())) {
                    return value;
                }
            }
        }
        return null;
    }

    FileTypeEnum(Integer code, String name, String suffix) {
        this.code = code;
        this.name = name;
        this.suffix =suffix;
    }
}
